import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutterproject/config/route_config.dart';
import 'package:flutterproject/mvvm/base/base_state.dart';
import 'package:flutterproject/page/login_all/login/widget/input_eye.dart';
import 'package:flutterproject/page/login_all/set_pwd/controller/set_pwd_controller.dart';
import 'package:flutterproject/util/extension/extension_util.dart';
import 'package:flutterproject/util/extension/widget_extension.dart';
import 'package:flutterproject/util/margin_padding_util.dart';
import 'package:flutterproject/widget/button_common.dart';
import 'package:flutterproject/widget/image_extended.dart';
import 'package:flutterproject/widget/text/text_common.dart';
import 'package:get/get.dart';

class SetPwdPage extends BaseState<SetPwdController> {
  @override
  SetPwdController initController() => SetPwdController();

  @override
  Widget initView(BuildContext context) {
    return Scaffold(
      resizeToAvoidBottomInset: false,
      body: Container(
        width: Get.width,
        height: Get.height,
        padding: MarginPaddingUtil.symmetric(horizontal: 50),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            237.heightBox,
            TextCommon(
              "设置密码",
              size: 50.sp,
              color: Color(0xFFFF242429),
              fontWeight: FontWeight.bold,
            ),
            15.heightBox,
            Row(
              children: [
                ImageCommon(
                  "/icon/warn",
                  size: 32.sp,
                ),
                15.widthBox,
                TextCommon(
                  "6-20位字符，不可以是纯数字或者符号",
                  size: 28.sp,
                  color: Color(0xFF242429),
                  align: TextAlign.center,
                )
              ],
            ),
            90.heightBox,
            InputEye(
              hint: '设置登录密码',
              isShowEye: true,
              controller: controller.pwd,
              onchange: (value) => controller.onChange(),
              focusNode: controller.pwdFocusNode,
            ),
            InputEye(
              hint: '再次输入登录密码',
              isShowEye: true,
              controller: controller.pwdConfirm,
              onchange: (value) => controller.onChange(),
              focusNode: controller.pwdConfirmFocusNode,
            ),
            InputEye(
              hint: '设置支付密码',
              controller: controller.pay,
              onchange: (value) => controller.onChange(),
              focusNode: controller.payFocusNode,
            ),
            InputEye(
              hint: '输入邀请码',
              controller: controller.invite,
              onchange: (value) => controller.onChange(),
              focusNode: controller.inviteFocusNode,
            ),
            Spacer(),
            Row(
              children: [
                SizedBox.shrink(),
                Spacer(),
                TextCommon(
                  "已有账号？",
                  size: 28.sp,
                  color: Color(0xFFFF707070),
                ),
                TextCommon(
                  "去登录",
                  size: 28.sp,
                  color: Color(0xFFEDC88B),
                ),
              ],
            ).addClickEvent(() => Get.offAllNamed(RouteName.loginPage.toString())),
            42.heightBox,
            ButtonCommon(
              text: "下一步",
              onTap: () => controller.onConfirm(),
              fontSize: 32.sp,
              fontColor: Colors.white,
              color: Color(0xFFEDC88B),
              // controller.isAllCorrect
              //     ? Color(0xFFEDC88B)
              //     : Color(0xFF6E6E6E).withOpacity(0.5),
              borderRadios: 50,
              padding: MarginPaddingUtil.only(top: 25, bottom: 29),
            ),
            36.heightBox,
          ],
        ),
      ),
    );
  }
}
